package bigoo.peer;

import bigoo.util.Config;
import eduni.simjava.Sim_entity;
import eduni.simjava.Sim_port;
import eduni.simjava.Sim_system;

public class EpidemicSource extends Sim_entity {

    private Sim_port out;

    public EpidemicSource(String peerID) {
	super(peerID + "Epidemic");
	this.out = new Sim_port("out");
	this.add_port(this.out);
    }

    @Override
    public void body() {
	while (Sim_system.running()) {
	    this.sim_pause(Double.parseDouble(Config.getProperty(Config.EPIDEMIC_INTERVAL)));
	    this.sim_schedule(this.out, 0.0, BigooPeer.EPIDEMIC_PROPAGATION_EVENT, null);
	}
    }
}
